import Vue from 'vue'
import * as Util from '../components/Util'

let CommonService = {
  install (Vue, options) {
    // 给vue增添对话框显示方法
    Vue.CommonService = Vue.prototype.$CommonService = CommonService
  },

  waterCalculate (model, prewater) {
    return Vue.post('rs/logic/waterfeecalculate', {data: {f_user_id: model.f_user_id, water: prewater}}, {resolveMsg: null, rejectMsg: '获取金额失败'})
  },

  // feeCalculate (model, preamount) {
  //   return Vue.post('rs/logic/waterfeecalculate', {data: {model: model, isWaterValue: 1, value: preamount}}, {resolveMsg: null, rejectMsg: '获取水量失败'})
  // },
  writeCardParams (params, cardRes) {
    return {
      f_manufacturers: params.factory,
      f_card_id: params.kh,
      f_card_water: params.ql,
      f_times: params.cs,
      // f_state: ''
      f_police_water: params.bjql,
      f_operator: Util.f.name,
      f_card_state: cardRes.data.Err,
      f_card_times: cardRes.data.Cs
    }
  }
}

export default CommonService
